﻿/*
 * arguments.h
 */
#ifndef __GDK_ARGUMENTS_H__
#define __GDK_ARGUMENTS_H__

#include <gdk/core/Types.h>
#include <gdk/core/String.h>


namespace gdk
{


	//分析字符串参数
	GDK_CORE_EXPORT void parseArguments
	(
		const Char *text,
		Char **argv,
		Char *args,
		int *numargs,
		int *numchars
	);
	GDK_CORE_EXPORT void parseArguments(const Char *text, Char **&args, int &numargs);
		
	//分析参数，从字窜str中，
	//如字串 "ip=192.168.0.1"
	//可以通过 parseArgumentString(str,"ip") 返回 "192.168.0.1"
	GDK_CORE_EXPORT String parseArgumentString(const Char *str, const Char *name, const Char *def = __TEXT__(""));

	//分析参数，从字窜str中， 如字串 "port=12345"
	//可以通过 parseArgumentInt(str,"port") 获得 12345
	GDK_CORE_EXPORT int parseArgumentInt(const Char *str, const Char *name, int def = 0);
	GDK_CORE_EXPORT int64_t parseArgumentInt64(const Char *str, const Char *name, int64_t def = 0);



}//namespace gdk



#endif //__GDK_ARGUMENTS_H__